package book_management.book;

/**
 * 书本实体类
 * @author yuisama
 * @date 2022/01/11 19:26
 **/
public class Book {
    // 书名
    private String bookName;
    // 作者
    private String author;
    // 价格
    private double price;
    // 书籍类别
    private String type;
    // 借阅状态。默认false
    private boolean isBorrowed;

    public Book(String bookName, String author, double price, String type) {
        this.bookName = bookName;
        this.author = author;
        this.price = price;
        this.type = type;
    }

    // 只有需要修改的属性才需要提供setter - price、type、借阅状态


    public void setPrice(double price) {
        this.price = price;
    }

    public void setType(String type) {
        this.type = type;
    }

    public void setBorrowed(boolean borrowed) {
        isBorrowed = borrowed;
    }

    public String getBookName() {
        return bookName;
    }

    public String getAuthor() {
        return author;
    }

    public double getPrice() {
        return price;
    }

    public String getType() {
        return type;
    }

    public boolean isBorrowed() {
        return isBorrowed;
    }

    @Override
    public String toString() {
        return "Book{" +
                "bookName='" + bookName + '\'' +
                ", author='" + author + '\'' +
                ", price=" + price +
                ", type='" + type + '\'' +
                ", isBorrowed=" + isBorrowed +
                '}';
    }
}